import { Tabs } from 'nextra/components'
import { Callout } from 'nextra/components'

# CDN Configuration

Used to configure the CDN path. To reduce the size of the Umo Editor core package and improve loading speed, Umo Editor introduces some static resources via CDN configuration. These static resources include third-party modules, images, icon resources, etc.

## Default Configuration

```js
{
  cdnUrl: 'https://unpkg.com/@umoteam/editor-external@4',
}
```

In the Umo Editor Next version, the included Umo Editor Server provides a `/static` route for returning static files from `@umoteam/editor-external`. You can configure it to use the route address provided in Umo Editor Server, for example `http://127.0.0.1/static`.

## Using Public CDN

```js
{
  // Using unpkg.com
  cdnUrl: 'https://unpkg.com/@umoteam/editor-external@latest',
  // Or using jsdelivr.net
  // cdnUrl: 'https://cdn.jsdelivr.net/npm/@umoteam/editor-external@latest',
}
```

## Using Local Resources

For scenarios like improving loading speed further or working in an intranet environment, you can copy the files under `node_modules/@umoteam/editor-external/` to the `public/` directory and set `cdnUrl` to `location.origin`.

You can quickly copy files to the project **root directory** using the following commands:

<Tabs items={['Windows', 'Linux / MacOS / Others']}>
<Tabs.Tab>
```bash
mkdir -p public/libs
mkdir -p public/icons
mkdir -p public/static
xcopy node_modules\@umoteam\editor-external\libs\* public\libs\ /E /I
xcopy node_modules\@umoteam\editor-external\icons\* public\icons\ /E /I
xcopy node_modules\@umoteam\editor-external\static\* public\static\ /E /I
```
</Tabs.Tab>
<Tabs.Tab>
```bash
mkdir -p public/libs
mkdir -p public/icons
mkdir -p public/static
cp -r node_modules/@umoteam/editor-external/libs/* public/libs/
cp -r node_modules/@umoteam/editor-external/icons/* public/icons/
cp -r node_modules/@umoteam/editor-external/static/* public/static/
```
</Tabs.Tab>
</Tabs>

<Callout type="warning" emoji="⚠️">
**Note**: After updating the `@umoteam/editor` version, please copy the latest `@umoteam/editor-external` files to the `public` directory. Ensure the version matches `@umoteam/editor-external`.
</Callout>

<Callout type="info">
You can also place the files under `node_modules/@umoteam/editor-external/` in a suitable location and configure `cdnUrl` correctly. Ensure it does not end with a `/`.
</Callout>

## Configuration Items

### cdnUrl

**Description**: CDN path.

**Type**: `String`

**Default Value**: `https://unpkg.com/@umoteam/editor-external@latest`

**Configuration Items**: A valid [URL](https://developer.mozilla.org/en-US/docs/Learn/Common_questions/Web_mechanics/What_is_a_URL) value, must not end with `/`.